<!--圈子信息列表-->
<script type="text/javascript">
var default_choose = "{$info.mid==5?'cnt_shop':'cnt_bbs'}";	//默认显示哪个模块
</script>

{qb:hy name="wap_qun_list_set" type="myform" conf="index_style/default/qun/content/wapshow/list_set.php"}
<script type="text/javascript">
default_choose = "{$_cfg.default_show_sys}";

$(function(){
	{if $_cfg.title_cnt_bbs}$(".title-btn .swiper-slide[data-type='cnt_bbs']").html("{$_cfg.title_cnt_bbs}");{/if}
	{if $_cfg.title_cnt_topic}$(".title-btn .swiper-slide[data-type='cnt_topic']").html("{$_cfg.title_cnt_topic}");{/if}
	{if $_cfg.title_cnt_ping}$(".title-btn .swiper-slide[data-type='cnt_ping']").html("{$_cfg.title_cnt_ping}");{/if}
	{if $_cfg.title_cnt_appstore}$(".title-btn .swiper-slide[data-type='cnt_appstore']").html("{$_cfg.title_cnt_appstore}");{/if}
	{if $_cfg.title_cnt_booking}$(".title-btn .swiper-slide[data-type='cnt_booking']").html("{$_cfg.title_cnt_booking}");{/if}
	{if $_cfg.title_cnt_shop}$(".title-btn .swiper-slide[data-type='cnt_shop']").html("{$_cfg.title_cnt_shop}");{/if}
	{if $_cfg.title_cnt_news}$(".title-btn .swiper-slide[data-type='cnt_news']").html("{$_cfg.title_cnt_news}");{/if}
	{if $_cfg.title_cnt_photo}$(".title-btn .swiper-slide[data-type='cnt_photo']").html("{$_cfg.title_cnt_photo}");{/if}
});
</script>
{/qb:hy}

<style type="text/css">
.title-btn .cnt-box{
	display:none;
}
.title-btn .cnt_ping{
	display:block;	/*默认显示的数据*/
}

.title-btn .head{
	height:31px;
}
.title-btn .tag{
	padding-left:15px;
	padding-right:15px;
}
.title-btn .ck{
	color:#133CD7;
	border-bottom:1px solid #133CD7;
}
.swiper-slide{width: auto!important;}	/*滑动按钮必须的设置,其中swiper-slide类名不能更换*/
</style>
<!-- 滑动按钮要用到的CSS与JS文件,他涉及到三个class类 swiper-container swiper-wrapper swiper-slide -->
<link href="__STATIC__/libs/swiper/swiper.min.css" rel="stylesheet">
<script src="__STATIC__/libs/swiper/swiper.min.js"></script>
<script>
    $(function () {
        var swiper = new Swiper('.swiper-container', {
            spaceBetween: 0,
            slidesPerView:'auto',
            freeMode: true
        });
    })
</script>
	<div class="SideBox title-btn">
		<!--切换菜单开始-->
		<div class="head">
			<div class="swiper-container">
				<div class="swiper-wrapper">
					<span class="tag swiper-slide" data-type="cnt_topic">专题 <i>0</i></span>
					<span class="tag swiper-slide ck" data-type="cnt_ping">评论 <i>0</i></span>
					<span class="tag swiper-slide" data-type="cnt_bbs">{:modules_config('bbs')['name']} <i>0</i></span>
					{if modules_config('appstore')}<span class="tag swiper-slide" data-type="cnt_appstore">{:modules_config('appstore')['name']} <i>0</i></span>{/if}
					{if modules_config('booking')}<span class="tag swiper-slide" data-type="cnt_booking">{:modules_config('booking')['name']} <i>0</i></span>{/if}
					{if modules_config('shop')}<span class="tag swiper-slide" data-type="cnt_shop">{:modules_config('shop')['name']} <i>0</i></span>{/if}
					{if modules_config('cms')}<span class="tag swiper-slide" data-type="cnt_news">{:model_config(1,'cms')['title']} <i>0</i></span>{/if}
					{if modules_config('cms')}<span class="tag swiper-slide" data-type="cnt_photo">{:model_config(2,'cms')['title']} <i>0</i></span>{/if}
				</div>
			</div>
		</div>
		<!--切换菜单结束-->
		<!--专题开始-->
		<div class="cnt-box cnt_topic listBbs">
			<!-- where="ext_sys=0&ext_mid=0" 这里可以指定某个频道及某个模型,比如 where="ext_sys=cms&ext_mid=1" -->
			{qb:hy name="qun_wapshow_topic001"  class="app\qun\model\Topic@get_label" union="aid=id" where="ext_sys=0&ext_mid=0" rows="8" js="cnt_topic"}
			<div class="lists" style="border-bottom:1px solid #eee;"> 
				<ul>
					<li class="img"><a href="{:get_url('user',$rs.uid)}"><img src="{$rs.uid|get_user_icon}" onerror="this.src='__STATIC__/images/nopic.png'"></a></li>
					<li class="info"><span>{$rs.uid|get_user_name}</span><em>{$rs.create_time|format_time="Y-m-d"}</em></li>
					<li class="more"><span>{if ($rs.status>1)}精{elseif (time()-$rs.create_time<3600*24)}新{elseif ($rs.view>10)}热{/if}</span></li>
				</ul>
				<a href="{$rs.url}">
				<dl>
					<dt>{$rs.title}</dt>
				</dl>
				</a>
			</div>
			{/qb:hy}
		</div>
		<!--专题结束-->	
		<!--评论开始-->
		<div class="cnt-box cnt_ping listBbs">
			{qb:hy name="qun_wapshow_bbs002" type="bbs" mid="2" where="ext_id=$id" order="qun_status desc,list desc" rows="8" js="cnt_ping"}
			<div class="lists" style="position: relative;">

			<div style="position: absolute;right:60px;top:30px;filter: z-index: 1;"><img style="width:50px;opacity:0.7;filter:alpha(opacity=70);transform:rotate(340deg);-ms-transform:rotate(340deg);-moz-transform:rotate(340deg);-webkit-transform:rotate(340deg);-o-transform:rotate(340deg);" src="__STATIC__/bbs/ping_{$rs.star}.png"></div>

				<ul>
					<li class="img"><a href="{$rs.user_url}"><img src="{$rs.user_icon}" onerror="this.src='__STATIC__/images/nopic.png'"></a></li>
					<li class="info"><span>{$rs.username}</span><em>{$rs.time}</em></li>
					<li class="more"><span>{if ($rs.status>1)}精{elseif (time()-$rs.create_time<3600*24)}新{elseif ($rs.view>10)}热{/if}</span></li>
				</ul>
				<a href="{$rs.url}">
				<dl>
					<dt>{:get_word(del_html($rs.title),200)}</dt>
					{if (count($rs.picurls)>2)}
					<dd>
						{volist name="$rs.picurls" id="pic"}
							{lt name="i" value="4"}
								<div><span><img src="{$pic.picurl}"onerror="this.src='__STATIC__/images/nopic.png'" width="78" height="78" /></span></div>
							{/lt}
						{/volist}
					</dd>
					{/if}
				</dl>
				</a>
				<div class="others">
					<span><i class="fa fa-thumbs-o-up">{$rs.agree}</i></span>
					<em><i class="fa fa-commenting-o">{$rs.replynum}</i></em>
					<em><i class="glyphicon glyphicon-remove-sign act-delete" data-id="{$rs.id}" data-uid="{$rs.uid}" data-sys="bbs"></i></em>
					<em><i class="fa fa-arrow-up act-top" data-id="{$rs.id}" data-type="{$rs.qun_status}" data-sys="bbs"></i></em>
				</div>
			</div>
			{/qb:hy}
		</div>
		<!--评论结束-->
		<!--论坛开始-->
		<div class="cnt-box cnt_bbs listBbs">
			{qb:hy name="qun_wapshow_bbs001" type="bbs" where="ext_id=$id" order="qun_status desc,list desc" rows="8" js="cnt_bbs"}
			<div class="lists">
				<ul>
					<li class="img"><a href="{$rs.user_url}"><img src="{$rs.user_icon}" onerror="this.src='__STATIC__/images/nopic.png'"></a></li>
					<li class="info"><span>{$rs.username}</span><em>{$rs.time}</em></li>
					<li class="more"><span>{if ($rs.status>1)}精{elseif (time()-$rs.create_time<3600*24)}新{elseif ($rs.view>10)}热{/if}</span></li>
				</ul>
				<a href="{$rs.url}">
				<dl>
					<dt>{$rs.title}</dt>
					{if (count($rs.picurls)>2)}
					<dd>
						{volist name="$rs.picurls" id="pic"}
							{lt name="i" value="4"}
								<div><span><img src="{$pic.picurl}"onerror="this.src='__STATIC__/images/nopic.png'" width="78" height="78" /></span></div>
							{/lt}
						{/volist}
					</dd>
					{/if}
				</dl>
				</a>
				<div class="others">
					<span><i class="fa fa-thumbs-o-up">{$rs.agree}</i></span>
					<em><i class="fa fa-commenting-o">{$rs.replynum}</i></em>
					<em><i class="glyphicon glyphicon-remove-sign act-delete" data-id="{$rs.id}" data-uid="{$rs.uid}" data-sys="bbs"></i></em>
					<em><i class="fa fa-arrow-up act-top" data-id="{$rs.id}" data-type="{$rs.qun_status}" data-sys="bbs"></i></em>
				</div>
			</div>
			{/qb:hy}
		</div>
		<!--论坛结束-->		
		<!--应用市场开始-->
		{if modules_config('appstore')}
		<div class="cnt-box cnt_appstore listPhoto">
			{qb:hy name="qun_wapshow_appstore001" type="appstore" mid="-1" where="uid=$info.uid" order="id" by="desc" rows="6" js="cnt_appstore"}
			<li><a href="{$rs.url}"><span><img src="{$rs.picurl}" onerror="this.src='__STATIC__/images/nopic.png'"></span><em>{$rs.title}</em></a>
			</li>
			{/qb:hy}
		</div>
		{/if}
		<!--应用市场结束-->
		<!--商城开始-->
		{if modules_config('shop')}
		<div class="cnt-box cnt_shop listPhoto">
			{qb:hy name="qun_wapshow_shop001" type="shop" mid="1" where="uid=$info.uid" order="id" by="desc" rows="6" js="cnt_shop"}
			<li><a href="{$rs.url}"><span><img src="{$rs.picurl}" onerror="this.src='__STATIC__/images/nopic.png'"></span><em>{$rs.title}</em></a>
			<i class="glyphicon glyphicon-remove-sign act-delete" data-id="{$rs.id}" data-uid="{$rs.uid}" data-sys="shop"></i>
			</li>
			{/qb:hy}
		</div>
		{/if}
		<!--商城结束-->
		<!--拼团开始-->
		{if modules_config('booking')}
		<div class="cnt-box cnt_booking listPhoto">
			{qb:hy name="qun_wapshow_booking001" type="booking" mid="1" where="uid=$info.uid" order="id" by="desc" rows="6" js="cnt_booking"}
			<li><a href="{$rs.url}"><span><img src="{$rs.picurl}" onerror="this.src='__STATIC__/images/nopic.png'"></span><em>{$rs.title}</em></a>
			</li>
			{/qb:hy}
		</div>
		{/if}
		<!--拼团结束-->
		<!--图片开始-->
		{if modules_config('cms')}
		<div class="cnt-box cnt_photo listPhoto">
			{qb:hy name="qun_wapshow_photo001" type="cms" mid="2" where="uid=$info.uid" order="id" by="desc" rows="6" js="cnt_photo"}
			<li><a href="{$rs.url}"><span><img src="{$rs.picurl}" onerror="this.src='__STATIC__/images/nopic.png'"></span><em>{$rs.title}</em></a>
			</li>
			{/qb:hy}
		</div>
		{/if}
		<!--图片结束-->
		<!--文章开始-->
		{if modules_config('cms')}
		<div class="cnt-box cnt_news listBbs">
			{qb:hy name="qun_wapshow_news001" type="cms" mid="1" where="uid=$info.uid" order="id" by="desc" rows="8" js="cnt_news"}
			<div class="lists">
				<ul>
					<li class="img"><a href="{$rs.user_url}"><img src="{$rs.user_icon}" onerror="this.src='__STATIC__/images/nopic.png'"></a></li>
					<li class="info"><span>{$rs.username}</span><em>{$rs.time}</em></li>
					<li class="more"><span>{if ($rs.status>1)}精{elseif (time()-$rs.create_time<3600*24)}新{elseif ($rs.view>10)}热{/if}</span></li>
				</ul>
				<a href="{$rs.url}">
				<dl>
					<dt>{$rs.title}</dt>
					{if (count($rs.picurls)>2)}
					<dd>
						{volist name="$rs.picurls" id="pic"}
							{lt name="i" value="4"}
								<div><span><img src="{$pic.picurl}"onerror="this.src='__STATIC__/images/nopic.png'" width="78" height="78" /></span></div>
							{/lt}
						{/volist}
					</dd>
					{/if}
				</dl>
				</a>
			</div>
			{/qb:hy}
		</div>
		{/if}
		<!--文章结束-->
		<!--<div class="ShowMore2" onclick='showMoreCnt()'><span>点击查看更多</span></div>-->
	</div>
</div>

<script type="text/javascript">
//切换按钮
$(function(){
	$(".title-btn .swiper-slide").click(function(){
		choose_sys_type($(this));
	});
});

function choose_sys_type(that){
	$(".title-btn .swiper-slide").removeClass('ck');
	that.addClass('ck');
	now_type = that.data('type');
	$('.title-btn .cnt-box').hide();
	$('.title-btn .'+now_type).show();
	scroll_get = true;
	//showMoreCnt();
}


$(function(){
	setTimeout(function(){
		let that = $(".title-btn .swiper-slide[data-type='"+default_choose+"']");
		let left = that.offset().left+that.width();
		if(left>$(window).width()){
			$(".title-btn .swiper-wrapper").css("transform","translate3d(-"+(left-300)+"px, 0px, 0px)");
		}		
		choose_sys_type(that);
	},1000);
});

var now_type = 'cnt_ping';	//当前显示的模块
//加载每个频道的分页地址
var url_db = {
	cnt_topic:"{qb:hy_url name='qun_wapshow_topic001' /}",
	cnt_bbs:"{qb:hy_url name='qun_wapshow_bbs001' /}",
	cnt_ping:"{qb:hy_url name='qun_wapshow_bbs002' /}",
	cnt_shop:"{qb:hy_url name='qun_wapshow_shop001' /}",
	cnt_booking:"{qb:hy_url name='qun_wapshow_booking001' /}",
	cnt_news:"{qb:hy_url name='qun_wapshow_news001' /}",
	cnt_photo:"{qb:hy_url name='qun_wapshow_photo001' /}",
	cnt_appstore:"{qb:hy_url name='qun_wapshow_appstore001' /}",
};

var page_db = {};	//每个频道的页码数
function showMoreCnt(){
	if(typeof(page_db[now_type])=='undefined'){
		page_db[now_type] = 1;
	}
	page_db[now_type]++;
	var url = url_db[now_type] + page_db[now_type];
	$.get(url,function(res){	
		if(res.code==0){
			if(res.data==''){
				if(page_db[now_type]>3)layer.msg("已经显示完了！",{time:500});
				//$('.ShowMore2').hide();
			}else{
				$('.title-btn .'+now_type).append(res.data);
				scroll_get = true;
			}
		}else{
			layer.msg(res.msg,{time:2500});
		}
	});
}


//滚动显示更多
var scroll_get = true;	//做个标志,不要反反复复的加载
$(document).ready(function () {
	$(window).scroll(function () {
		if (scroll_get==true &&  (400 + $(window).scrollTop())>($(document).height() - $(window).height())) {
			scroll_get = false;
			if(typeof(page_db[now_type])>1)layer.msg('内容加截中,请稍候',{time:1500});
			showMoreCnt();
		}
	});
});

//异步处理,对应的数据不存在,就隐藏其按钮
function cnt_topic(res){
	if(res.paginate.total==0){
		$(".swiper-slide[data-type='cnt_topic']").hide();
		//choose_sys_type($(".title-btn .swiper-slide[data-type='cnt_bbs']"));
	}else{
		$(".swiper-slide[data-type='cnt_topic'] i").html(res.paginate.total);
	}
}
function cnt_ping(res){
	if(res.paginate.total==0){
		$(".swiper-slide[data-type='cnt_ping']").hide();
	}else{
		$(".swiper-slide[data-type='cnt_ping'] i").html(res.paginate.total);
	}
}
function cnt_shop(res){
	if(res.paginate.total==0){
		$(".swiper-slide[data-type='cnt_shop']").hide();
	}else{
		$(".swiper-slide[data-type='cnt_shop'] i").html(res.paginate.total);
	}
}
function cnt_booking(res){
	if(res.paginate.total==0){
		$(".swiper-slide[data-type='cnt_booking']").hide();
	}else{
		$(".swiper-slide[data-type='cnt_booking'] i").html(res.paginate.total);
	}
}
function cnt_appstore(res){
	if(res.paginate.total==0){
		$(".swiper-slide[data-type='cnt_appstore']").hide();
	}else{
		$(".swiper-slide[data-type='cnt_appstore'] i").html(res.paginate.total);
	}
}
function cnt_news(res){
	if(res.paginate.total==0){
		$(".swiper-slide[data-type='cnt_news']").hide();
	}else{
		$(".swiper-slide[data-type='cnt_news'] i").html(res.paginate.total);
	}
}
function cnt_photo(res){
	if(res.paginate.total==0){
		$(".swiper-slide[data-type='cnt_photo']").hide();
	}else{
		$(".swiper-slide[data-type='cnt_photo'] i").html(res.paginate.total);
	}
}


//对论坛异步加载进来的数据做处理
function cnt_bbs(res){
	if(res.code==0){	//数据加载成功后		
		if(res.paginate.total==0){
			$(".swiper-slide[data-type='cnt_bbs']").hide();
		}else{
			act_delete();
			act_top();
			$(".swiper-slide[data-type='cnt_bbs'] i").html(res.paginate.total);
		}
	}
}


//贴子的删除功能
function act_delete(){
	var power = {if $userdb.groupid==3||$gid==2} true {else /} false {/if};
	$(".act-delete").each(function(){
		var that = $(this);
		if(power!=true && '{$userdb.uid}'!=that.data('uid')){
			that.hide();
		}
		var url = "{:urls('wxapp.act/delete')}?sysname=" + that.data('sys') + '&id=' + that.data('id');
		that.click(function(){
			layer.confirm('你确认要删除吗?',{btn:['确认删除','取消'],},function(){			
				$.get(url,function(res){
					layer.closeAll();
					if(res.code==0){					
						layer.msg('删除成功');
						setTimeout(function(){
							window.location.reload();
						},500);
					}else{
						layer.alert(res.msg);
					}
				});
			});
		});
	});
}

//贴子的置顶功能
function act_top(){
	var power = {if $userdb.groupid==3||$gid==2} true {else /} false {/if};
	$(".act-top").each(function(){
		var that = $(this);
		if(power!=true){
			that.hide();
		}
		if(that.data('type')!='0'){
			that.css({'color':'blue'});
		}
		var url = "{:urls('wxapp.act/top')}?sysname=" + that.data('sys') + '&id=' + that.data('id');
		that.click(function(){
			layer.confirm('你确认执行置顶相关吗?',{btn:['确认','取消'],},function(){			
				$.get(url,function(res){
					layer.closeAll();
					if(res.code==0){					
						layer.msg('执行成功');
						setTimeout(function(){
							window.location.reload();
						},500);
					}else{
						layer.alert(res.msg);
					}
				});
			});
		});
	});
}
//act_top();


</script>

<div style="display:none;" class="taglabel">目的是不给用户复制当前碎片</div>